﻿<template>
    <el-dialog :close-on-press-escape="false" :append-to-body="true" :visible="show" @opened="opened" @closed="closed" @close="show=false" :close-on-click-modal="false">
        <el-form ref="wmsWaybill" label-position="right" label-width="120px" :model="wmsWaybill" :rules="rules">
            <input type="hidden" :model="wmsWaybill.id" />
                                    <el-form-item label="创建时间" prop="createTime">
                                <el-date-picker type="date" @change="cbtime" v-model="wmsWaybill.createTime" placeholder="创建时间" style="width: 240px"></el-date-picker>
                            </el-form-item>
                                                <el-form-item label="外部ERP单号" prop="erpOrder">
                                <el-input v-model="wmsWaybill.erpOrder" placeholder="外部ERP单号" style="width: 240px" />
                            </el-form-item>
                                                                        <el-form-item label="" prop="partnerId">
                                <el-input v-model="wmsWaybill.partnerId" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="partnerName">
                                <el-input v-model="wmsWaybill.partnerName" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="快递单号" prop="pdfPath">
                                <el-input v-model="wmsWaybill.pdfPath" placeholder="快递单号" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="pic1">
                                <el-input v-model="wmsWaybill.pic1" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="pic2">
                                <el-input v-model="wmsWaybill.pic2" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="附近图片" prop="pic3">
                                <el-input v-model="wmsWaybill.pic3" placeholder="附近图片" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="打印时间" prop="printTime">
                                <el-date-picker type="date" @change="cbtime" v-model="wmsWaybill.printTime" placeholder="打印时间" style="width: 240px"></el-date-picker>
                            </el-form-item>
                                                <el-form-item label="" prop="recipientAddress">
                                <el-input v-model="wmsWaybill.recipientAddress" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="recipientName">
                                <el-input v-model="wmsWaybill.recipientName" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="recipientPhone">
                                <el-input v-model="wmsWaybill.recipientPhone" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="remark">
                                <el-input v-model="wmsWaybill.remark" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="出库时间" prop="shipTime">
                                <el-date-picker type="date" @change="cbtime" v-model="wmsWaybill.shipTime" placeholder="出库时间" style="width: 240px"></el-date-picker>
                            </el-form-item>
                                                <el-form-item label="订单来源" prop="source">
                                <el-input v-model="wmsWaybill.source" placeholder="订单来源" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="state">
                                <el-input v-model="wmsWaybill.state" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="sysRemark">
                                <el-input v-model="wmsWaybill.sysRemark" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="toPartnerId">
                                <el-input v-model="wmsWaybill.toPartnerId" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="客户" prop="toPartnerName">
                                <el-input v-model="wmsWaybill.toPartnerName" placeholder="客户" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="快递单号" prop="trackingNo">
                                <el-input v-model="wmsWaybill.trackingNo" placeholder="快递单号" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="出货单号" prop="waybillOrder">
                                <el-input v-model="wmsWaybill.waybillOrder" placeholder="出货单号" style="width: 240px" />
                            </el-form-item>
                                </el-form>
        <div slot="footer">
            <el-button @click="cancel">取消</el-button>
            <el-button type="primary" :loading="modalLoading" @click="ok">确定</el-button>
        </div>
    </el-dialog>
</template>
<script>
export default {
    name: 'WmsWaybill',
    data() {
        return {

            show: false,
            modalLoading: false,
            wmsWaybillId: "",
            wmsWaybill: {

            },
            rules: {

            }
        };
    },
    mounted: function() {


    },
    methods: {
        cbtime: function(value) {
            this.others;
        },
        opened() {

            this.getDetail();

        },
        closed() {
            this.wmsWaybill = {

            }
        },
        showDialog(id) {
            this.wmsWaybillId = id;
            this.show = true;
        },
        getDetail: function() {
            if (this.wmsWaybillId == null || this.wmsWaybillId == undefined || this.wmsWaybillId == "") return;
            var me = this;
            me.showLoading();
            me.$http.post("/sys/wmswaybill/show_" + me.wmsWaybillId + ".do").then(response => {
                var body = response;
                if (body.status == 0) {
                    me.wmsWaybill= body.obj;

                }
                me.hideLoading();
            }, response => {
                me.hideLoading();
            });
        },
        ok: function() {
            var ok = false;
            this.$refs['wmsWaybill'].validate((valid) => {
                ok = valid;
                if (valid) {

                } else {
                    this.errorMessage('请认真填写数据');
                }
            })
            if (!ok) return;
            var me = this;

            me.modalLoading = true;
            me.$http.post("/sys/wmswaybill/doSave.action", me.wmsWaybill).then(response => {
                var body = response;
                if (body.status == 0) {
                    me.successMessage("保存成功！");
                    me.show = false;
                    me.$emit("ok");

                } else {
                    me.errorMessage(body.info);
                }
                me.modalLoading = false;
            }, response => {
                me.modalLoading = false;
            });
        },
        cancel: function() {
            this.wmsWaybill= {};
            this.show = false;
            this.$emit("cancel");
        }
    }
}
</script>
<style scoped>
</style>